package com.example.mail;


import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
import com.example.R;
import core.model.Game;

public class MailTabActivity extends TabActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mailtabs);

        Game game = (Game) this.getIntent().getExtras().getSerializable("game");

        Resources res = getResources();
        TabHost tabHost = getTabHost();
        TabHost.TabSpec spec;
        Intent intent;

        // intent for news
        intent = new Intent().setClass(this, MailNewsActivity.class);

        // spec for news
        spec = tabHost.newTabSpec("News").setIndicator("News",
                res.getDrawable(R.drawable.ic_tab_news))
                .setContent(intent);
        tabHost.addTab(spec);

        // intent for broadcasts
        intent = new Intent().setClass(this, MailListActivity.class);
        intent.putExtra("game", game);
        intent.putExtra("selectedMailType", "Broadcasts");

        // spec for broadcasts
        spec = tabHost.newTabSpec("broadcasts").setIndicator("Broadcasts",
                res.getDrawable(R.drawable.ic_tab_broadcasts))
                .setContent(intent);
        tabHost.addTab(spec);

        // intent for privates
        intent = new Intent().setClass(this, MailListActivity.class);
        intent.putExtra("game", game);
        intent.putExtra("selectedMailType", "Privates");

        // spec for privates
        spec = tabHost.newTabSpec("Privates").setIndicator("Privates",
                res.getDrawable(R.drawable.ic_tab_privates))
                .setContent(intent);
        tabHost.addTab(spec);

        tabHost.setCurrentTab(0);

    }
}
